---
layout: api
title: "v2.0.0 JavaScript Library: Global Switches"
categories: api
version: v2.0.0
permalink: /api/v2.0.0/l-global/
---
<h2 id="global">Global Switches</h2>

<p>Global switches are created for rare cases and generally make Leaflet to not detect a particular browser feature even if it's there. You need to set the switch as a global variable to <code><span class="literal">true</span></code> <em>before</em> including Leaflet on the page, like this:</p>

<pre><code>&lt;script&gt;L_PREFER_CANVAS = true;&lt;/script&gt;
&lt;script src="leaflet.js"&gt;&lt;/script&gt;</code></pre>

<table data-id='global'>
	<tr>
<th>Switch</th>
<th>Description</th>
	</tr>
	<tr>
<td><code><b>L_PREFER_CANVAS</b></code></td>
<td>Forces Leaflet to use the Canvas back-end (if available) for vector layers instead of SVG. This can increase performance considerably in some cases (e.g. many thousands of circle markers on the map).</td>
	</tr>
	<tr>
<td><code><b>L_NO_TOUCH</b></code></td>
<td>Forces Leaflet to not use touch events even if it detects them.</td>
	</tr>
	<tr>
<td><code><b>L_DISABLE_3D</b></code></td>
<td>Forces Leaflet to not use hardware-accelerated CSS 3D transforms for positioning (which may cause glitches in some rare environments) even if they're supported.</td>
	</tr>
</table>
